#include "stdafx.h"
#include "Vendor.h"

using namespace std;

bool IsAContainsB(const string &A, const string &B)
{
	if (A.empty() || B.empty() || A.length() < B.length())
		return false;
	if (A.find(B) != string::npos)
		return true;

	return false;
}
VendorID Vendor::GetPossibleVendorValues(const string &vendorStr)
{
	string candidate = "[HTC][HTC_HK]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HTC;

	candidate = "[Samsung]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_SAMSUNG;

	candidate = "[motorola][MOT]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_MOTOROLA;

	candidate = "[google]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_GOOGLE;

	candidate = "[huawei][sprd]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HUAWEI;

	candidate = "[ZTE][ZTE-gfan][ZTE-opda]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_ZTE;

	candidate = "[LGE][LG electronics][LG]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_LG;

	candidate = "[Dell Inc.][Dell Inc][Dell]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_DELL;

	candidate = "[TCT][TCL]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_TCL;

	candidate = "[lenovo][联想]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_LENOVO;

	candidate = "[CoolPad][YuLong]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_COOLPAD;

	candidate = "[SE][Sony Ericsson][SonyEricsson][Sony]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_SONY;

	candidate = "[Acer]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_ACER;

	candidate = "[asus]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_ASUS;

	candidate = "[FIH][Foxconn]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_FOXCONN;

	candidate = "[garmin-asus]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_GARMIN_ASUS;

	candidate = "[K-Touch][TIANYU]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_K_TOUCH;

	candidate = "[KT Tech]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_KT_TECH;

	candidate = "[Kyocera]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_KYOCERA;

	candidate = "[NEC]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_NEC;

	candidate = "[bn][Nook]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_NOOK;

	candidate = "[Nvidia]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_NVIDIA;

	candidate = "[Hisense]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HISENSE;

	candidate = "[OTGV]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_OTGV;

	candidate = "[Pantech]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_PANTECH;

	candidate = "[Pegatron]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_PEGATRON;

	candidate = "[Philips]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_PHILIPS;

	candidate = "[PMC-Sierra]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_PMC_SIERRA;

	candidate = "[Qualcomm]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_QUALCOMM;

	candidate = "[SK Telesys]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_SK_TELESYS;

	candidate = "[Sharp]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_SHARP;

	candidate = "[Toshiba]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_TOSHIBA;

	candidate = "[Meizu]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_MEIZU;

	candidate = "[dopod]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_DOPOD;

	candidate = "[Xiaomi]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_XIAOMI;

	candidate = "[BORQS]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_BORQS;

	candidate = "[Commtiva]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_COMMTIVA;

	candidate = "[Huaqi Portable Digital][Huaqi]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HUAQI;

	candidate = "[SK]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_SK;

	candidate = "[ZhiQi]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_ZHIQI;

	candidate = "[OPSSON]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_OPSSON;

	candidate = "[Hedy]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HEDY;

	candidate = "[Gionee]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_GIONEE;

	candidate = "[ChangHong]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_CHANGHONG;

	candidate = "[GaoXinQi]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_GAOXINQI;

	candidate = "[Ramos]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_RAMOS;

	candidate = "[AUX]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_AUX;

	candidate = "[Postcom][Newpostcom]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_POSTCOM;

	candidate = "[EBest]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_EBEST;

	candidate = "[Aigo][aigo Electronics Technology Co., Ltd]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_AIGO;

	candidate = "[Cher]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_CHER;

	candidate = "[CCPO]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_CCPO;

	candidate = "[Skyworth]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_SKYWORTH;

	candidate = "[Soaye]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_SOAYE;

	candidate = "[BBK]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_BBK;

	candidate = "[Vollo]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_VOLLO;

	candidate = "[Newsmy][Newman]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_NEWSMY;

	candidate = "[Onda]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_ONDA;

	candidate = "[Miki]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_MIKI;

	candidate = "[AMOI]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_AMOI;

	candidate = "[Hyundai]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HYUNDAI;

	candidate = "[OPPO]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_OPPO;

	candidate = "[SOP]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_SOP;

	candidate = "[Lingwin]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_LINGWIN;

	candidate = "[Qobo]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_QOBO;

	candidate = "[EPhone]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_EPHONE;

	candidate = "[Boway]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_BOWAY;

	candidate = "[Tonewin]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_TONEWIN;

	candidate = "[Tooky]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_TOOKY;

	candidate = "[YuSun]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_YUSUN;

	candidate = "[Archos]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_ARCHOS;

	candidate = "[Hosin]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HOSIN;

	candidate = "[Jiayu]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_JIAYU;

	candidate = "[Quanta]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_QUANTA;

	candidate = "[Kodak]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_KODAK;

	candidate = "[GigaByte]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_GIGABYTE;

	candidate = "[TI]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_TI;

	candidate = "[Hanwang]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HANWANG;

	candidate = "[Funai]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_FUNAI;

	candidate = "[Koobee]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_KOOBEE;

	candidate = "[UTime]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_UTIME;

	candidate = "[Fujitsu]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_FUJITSU;

	candidate = "[Compal]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_COMPAL;

	candidate = "[Positivo]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_POSITIVO;

	candidate = "[Lab126]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_LAB126;

	candidate = "[Kobo]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_KOBO;

	candidate = "[INQ]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_INQ_MOBILE;

	candidate = "[Teleepoch]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_TELEEPOCH;

	candidate = "[Lumigon]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_LUMIGON;

	candidate = "[Intel]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_INTEL;

	candidate = "[Vizio]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_VIZIO;

	candidate = "[Anydata]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_ANYDATA;

	candidate = "[Harris]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_HARRIS;

	candidate = "[BYD]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_BYD;

	candidate = "[Ouya]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_OUYA;

	candidate = "[Xiaomifeng]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_XIAOMIFENG;

	candidate = "[Amazon]";
	if (IsAContainsB(candidate, vendorStr))
		return VIDT_AMAZON;

	return VIDT_UNKNOWN;
}
